package com.hh.m15e.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hh.m15e.domain.Input6302;
import com.hh.m15e.domain.po.DSbZydj;
import com.hh.m15e.domain.po.SPYHWX2SbJs;
import com.hh.m15e.mapper.DSbZydjMapper;
import com.hh.m15e.mapper.SPYHWX2SbJsMapper;
import com.hh.m15e.service.ISPYHWX2SbJsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 作者: Ⅹ玖
 * 创建日期：2025/2/25 10:34
 * 文档描述：
 */
@Service
public class SPYHWX2SbJsServiceImpl extends ServiceImpl<SPYHWX2SbJsMapper, SPYHWX2SbJs> implements ISPYHWX2SbJsService {
    @Autowired
    private SPYHWX2SbJsMapper sPYHWX2SbJsMapper;

    @Autowired
    private DSbZydjMapper dSbZydjMapper;

    @Override
    public int saveData(Input6302 input6302) {
        // 通过暂存数据库查询数据
        DSbZydj dSbZydj = dSbZydjMapper.getDsbZydj(input6302.getMedOrgOrd());

        SPYHWX2SbJs spyhwx2SbJs = SPYHWX2SbJs.builder()
                .payOrdId(input6302.getPayOrdId())
                .medOrgOrd(input6302.getMedOrgOrd())
                .setlTime(input6302.getTraceTime())
                .feeSumamt(input6302.getFeeSumamt())
                .ownpayAmt(input6302.getOwnpayAmt())
                .psnAcctPay(input6302.getPsnAcctPay())
                .fundPay(input6302.getFundPay())
                .hiChrgTime(input6302.getHiChrgTime())
                .hiDocSn(input6302.getHiDocSn())
                .hiRgstSn(input6302.getHiRgstSn())
                .setlType(input6302.getSetlType())
                .cvlservFlag("")
                .cvlservPay("")
                .medType("")
                .brdy("-")
                .naty("-")
                .psnCashPay(input6302.getOwnpayAmt())
                .certno("")
                .hifmiPay("0")
                .psnNo(dSbZydj.getGrbh()) //1101出参psnNo字段
                .actPayDedc("0")
                .mdtrtCertType("01")
                .balc("0")
                .medinsSetlId(input6302.getHiDocSn())
                .psnCertType("01")
                .acctMulaidPay(input6302.getPsnAcctPay())
                .clrWay("")
                .hifobPay("0")
                .othPay("0")
                .medfeeSumamt(input6302.getFeeSumamt())
                .hifesPay("0")
                .gend("")
                .mdtrtId(dSbZydj.getJzxh()) //2201出参mdtrtId字段
                .acctPay(input6302.getPsnAcctPay())
                .fundPaySumamt(input6302.getFundPay())
                .fulamtOwnpayAmt("0")
                .hospPartAmt("0")
                .setlId(input6302.getPayOrdId())
                .inscpScpAmt("0")
                .insutype("")
                .mafPay("0")
                .psnName(dSbZydj.getBrxm()) //1101出参psnName字段
                .psnPartAmt("0")
                .clrOptins("")
                .poolPropSelfpay("0")
                .psnType("")
                .hifpPay("0")
                .overlmtSelfpay("0")
                .preselfpayAmt("0")
                .age("")
                .clrType("")
                .setldetail("")
                .outOfMIFee("0")
                .insuplcAdmdvs(dSbZydj.getJbjg()) //1101出参insuplcAdmdvs字段
                .build();
        return sPYHWX2SbJsMapper.saveData(spyhwx2SbJs);
    }
}
